# !/usr/bin/env python
# encoding: utf-8


"""
  @author: gaogao
  @file: get_wave_power_util.py
  @time: 2022/5/17 10:59
  @desc:
"""


def get_wave_power_value(wave, refrence_data):
    wave = float(wave)
    if wave in refrence_data[0]:
        wave_index = refrence_data[0].index(wave)
    else:
        wave = min(refrence_data[0], key=lambda x: abs(x - wave))
        wave_index = refrence_data[0].index(wave)
    return refrence_data[1][wave_index]


def get_wave_loss_gc(wave, loss_gc_data):
    wave = float(wave)
    if wave in loss_gc_data[0]:
        wave_index = loss_gc_data[0].index(wave)
    else:
        wave = min(loss_gc_data[0], key=lambda x: abs(x - wave))
        wave_index = loss_gc_data[0].index(wave)
    return loss_gc_data[1][wave_index]


# print(get_wave_loss_gc("1320", get_loss_data()))
